package cn.ym.mall.dao;

import cn.ym.mall.entity.Comment;

import java.sql.SQLException;
import java.util.List;

/**
 * 评论dao
 */
public interface CommentDao {

    /**
     * 通过商品查询评论
     * @param gid
     * @return
     */
    public List<Comment> getCommentByGid(Integer gid,Integer pageNo,Integer pageSize) throws SQLException;

    /**
     * 查询商品评论数
     * @param gid
     * @return
     */
    public long getCountByGid(Integer gid) throws SQLException;

    /**
     * 通过用户查询评论
     * @param uid
     * @return
     */
    public List<Comment> getCommentByUid(Integer uid,Integer pageNo,Integer pageSize) throws SQLException;

    /**
     * 查询用户评论数
     * @param uid
     * @return
     */
    public long getCountByUid(Integer uid) throws SQLException;

    /**
     * 添加评论
     * @param comment
     * @return
     */
    public int add(Comment comment) throws SQLException;

    /**
     * 删除评论
     * @param cid
     * @return
     */
    public int delete(Integer cid) throws SQLException;

    /**
     * 删除商品所有评论
     * @param gid
     * @return
     * @throws SQLException
     */
    public int deleteByGid(Integer gid) throws SQLException;
}
